(deffunction ask-question (?question $?allowed-values)
   (printout t ?question)
   (bind ?answer (read))
   (while (not (member ?answer ?allowed-values)) do
      (printout t ?question)
      (bind ?answer (read))
   )
   ?answer
)

(defrule assert-result
    (initial-fact)
  =>
    (printout t "Firing rule assert-result" crlf)
    (assert (result "The answer to life, the universe and everything!"))
    (send-to-java "HOLAAAAAA")
    (bind ?hola (read))
    (send-to-java ?hola)
)

(defrule send-result
    (result ?result)
  =>
    (printout t "Firing rule send-result" crlf)
    (send-to-java ?result)
)

(defrule do-rest
    (do-rest)
  =>
    (printout t "Firing rule do-rest" crlf)
)